
var data = JSON.parse(localStorage.getItem("data"))
	var uid = data.uid



//读

var token = data.token

var bookshelf = new Vue({
	el:'.line',
	data: {
		books :[]
	}
});


mui.init({
	pullRefresh: {
		container: '#offCanvasContentScroll',
		down: {
			callback: pulldownRefresh
		},
		up: {
			contentrefresh: '正在加载...',
			callback: pullupRefresh
		}
	}
});


var pageSize = 1
//下拉刷新具体业务实现
function pulldownRefresh() {
	setTimeout(function(){
		mui('#offCanvasContentScroll').pullRefresh().endPulldownToRefresh()
	},400)
}

//var addbook = JSON.parse(localStorage.getItem('books')) || [];
function pullupRefresh() {

	
common.ajax("student/myShelf/queryMyShelf",{
	uid:localStorage.getItem("uid"),
	token:token,
	readState:3,
	page:pageSize++,
	pageSize:3
},function(data){
	
	if(data.code == 200) {
			if(!data.data.hasNextPage) {
				mui('#offCanvasContentScroll').pullRefresh().endPullupToRefresh(true)
			}else{
				mui('#offCanvasContentScroll').pullRefresh().endPullupToRefresh()
			}
			
			for(var i = 0; i < data.data.list.length; i++) {
				bookshelf.books.push(data.data.list[i])
			}
			
		} else {
			mui.toast(data.message)
		}
		
//		console.log(bookshelf.books)
		
},'get')
}


if(mui.os.plus) {
	mui.plusReady(function() {
		setTimeout(function() {
			mui('#offCanvasContentScroll').pullRefresh().pullupLoading();
		}, 50);
        
	});
} else {
	mui.ready(function() {
		mui('#offCanvasContentScroll').pullRefresh().pullupLoading();
	});
}







